home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
CUJ9102.ARJ
/
9N02030A
< prev
next >
Wrap
Text File
|
1992-07-06
|
862b
|
31 lines
void
QuickSort( int *List, int Begin, int End )
{
int Value, Tmp, i, j;
if( End > Begin )
{
/* Divide the list in two */
Value = List[End];
i = Begin - 1;
j = End;
do {
while( List[++i] < Value );
while( List[--j] > Value );
Tmp = List[i];
List[i] = List[j];
List[j] = Tmp;
} while( j > i );
List[j] = List[i];
List[i] = List[End];
List[End] = Tmp;
/* Sort the first part */
QuickSort( List, Begin, i - 1 );
/* Sort the last part */
QuickSort( List, i + 1, End );
}
}